<template>
  <el-container>
    <el-header style="height: 90px">
      <login-header></login-header>
      <img :src="$store.state.user.portrait" alt="" />
      <el-button type="info" @click="logout">返回</el-button>
    </el-header>
    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="220px">
        <el-menu
          :default-active="$store.state.activePath"
          background-color="rgba(84,112,198,0)"
          text-color="#fff"
          active-text-color="#409FFF"
        >
          <!-- 后台首页 -->
          <el-menu-item index="/bghome" @click="toManagement('/bghome')">
            <template slot="title">
              <i class="el-icon-s-home"></i>
              <span>首页</span>
            </template>
          </el-menu-item>
          <!-- 一级菜单 -->
          <el-submenu
            class=""
            v-for="item of menuList"
            :key="item.index"
            :index="item.index"
          >
            <template slot="title">
              <i :class="item.icon"></i>
              <span>{{ item.title }}</span>
            </template>
            <!-- 二级菜单 -->
            <el-menu-item
              v-show="item.children"
              v-for="subItem of item.children"
              :key="subItem.index"
              :index="subItem.index"
              @click="toManagement(subItem.index)"
            >
              <template slot="title">
                <i :class="subItem.icon"></i>
                <span>{{ subItem.title }}</span>
              </template>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!-- 右边内容 -->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import LoginHeader from '@/components/LoginHeader';
export default {
  components: {
    LoginHeader,
  },
  data() {
    return {
      // 左侧菜单数据
      menuList: [
        {
          index: '1',
          icon: 'el-icon-menu',
          title: '板块管理',
          children: [
            {
              index: '/PlateList',
              icon: 'el-icon-s-order',
              title: '板块列表',
            },
          ],
        },
        {
          index: '2',
          icon: 'el-icon-folder-opened',
          title: '神话人物',
          children: [
            {
              index: '/PlateDetailList',
              icon: 'el-icon-document',
              title: '人物详情',
            },
            // {
            //   index: '/Recycleplate',
            //   icon: 'el-icon-delete',
            //   title: '回收站'
            // }
          ],
        },
        {
          index: '3',
          icon: 'el-icon-s-custom',
          title: '用户管理',
          children: [
            {
              index: '/usermanagement',
              icon: 'el-icon-data-line',
              title: '用户数据',
            },
          ],
        },
      ],
    };
  },
  methods: {
    logout() {
      // 返回home
      this.$router.push('/home');
    },
    // 跳转页面
    toManagement(path) {
      this.$router.push(path);
    },
  },
};
</script>

<style lang="less" scoped>
.el-container {
  height: 100%;
  background-image: url("@/assets/pageBg.png");
  overflow: hidden;
}
.el-header {
  position: relative;
  min-width: 1400px;
  padding-top: 6px;
  color: #fff;
  // background-color:  #eaedf1;
  img {
    position: absolute;
    top: 28px;
    right: 180px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
  }
  .el-button {
    position: absolute;
    top: 40px;
    right: 60px;
  }
}
.el-aside {
  // height: 90%;
  background-color:rgba(84, 112, 198, 0.2);
  // background-color: rgb(84,112,198);
  .el-menu {
    border: none;
  }
}
.el-main {
  // background-color: #eaedf151;
  box-sizing: border-box;
}
</style>
